#include <stdio.h>

int countdigit(int num, int digit);

int main() {
    int num, digit, result;
    scanf("%d", &num);
    result = countdigit(num, 2);
    printf("%d", result);
    return 0;
}

int countdigit(int num, int digit) {
    int count = 0;
    while (num > 0){
        if (num % 10 == digit) count++;
        num /= 10;
    }
    return count;
}